/**
 * 
 */
package cn.pzhu.chj.eureka.client1;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 
 * @author chenjie
 * @date 2018年8月22日 上午10:22:08
 * @since 1.8
 * 
 * @version 1.0
 */
@Controller
@RequestMapping("/ui")
public class ThymeleafController {
	
	@Autowired
	private HttpServletRequest request;

	@RequestMapping(value = "/{module}/{function}")
	public ModelAndView test(ModelAndView mv, @PathVariable("module") String module,
			@PathVariable("function") String function) {
		mv.setViewName("/" + module + "/" + function);
		Map<String, String> params = new HashMap<>();
		Enumeration<String> enumeration = request.getParameterNames();
		while (enumeration.hasMoreElements()) {
			String key = enumeration.nextElement();
			params.put(key, request.getParameter(key));
		}
		mv.addObject("params", params);
		return mv;
	}

}
